@extends('layout.admin')

@section('content')
<style>
	.pagelist{
		margin-left:200px;
	}
	.pagelist li a,span{
		width:40px;
		height:40px;
	}
</style>
<!-- 	<div class="clearfix"></div> -->
		<div class="col-md-12" >
			<div class="panel-head"><strong class="icon-reorder"> 轮播列表</strong></div>
				<form action="/admin/user/list" method='get' enctype='multipart/form-data'>
					<div id="DataTables_Table_0_length" class="dataTables_length">
						<label>显示 
						<select type='text' name="num" aria-controls="DataTables_Table_0" style='width:50px;height:30px'>
							<option value="5" @if($request->input('num') == 5) selected @endif>5</option>
							<option value="10" @if($request->input('num') == 10) selected @endif>10</option>
							<option value="15" @if($request->input('num') == 15) selected @endif>15</option>
							<option value="20" @if($request->input('num') == 20) selected @endif>20</option>
							</select> 页
						</label>
					</div>
				</form>	
				<table class="table table-hover text-center">
				    <tbody>
				    <tr>
				      <th width="5%">ID</th>
				      <th width="15%">路径</th>
				      <th width="10%">链接</th>
				      <th width="10%">图像</th>
				      <th width="10%">状态</th>
				      <th width="15%">操作</th>
				    </tr>
				 @foreach($res as $k=>$v)
				   	<tr class="@if($k % 2 == 0) even success @else odd active @endif">
				   		<td>{{$v->id}}</td>
				   		<td>{{$v->pic}}</td>
				   		<td>{{$v->address}}</td>
				   		<td><img src="{{$v->pic}}" alt="" height="50px"></td>
				   		<td>{{$v->status}}</td>
				   		<td>
				   			<button  class='btn btn-info edit' eid='{{$v->id}}' data-toggle="modal" data-target="#myModaledit">修改</button>
				   			<a href="/admin/lunbo/delete?id={{$v->id}}"><button class='btn btn-warning'>删除</button></a>
				   		</td>
				   	</tr>
				 @endforeach
				  	</tbody>
				</table>
				<script>
					$(function(){
						$('.edit').click(function(){
							// 获取属性值
							var id = $(this).attr('eid');
							// 设置隐藏域的值
							$('input[name=id]').val(id);
						});
					});
				</script>
		    </div>
	    </div>
@endsection